<?php
    $sql = "SELECT td_id,td_value FROM text_data WHERE td_id=6 OR td_id=28 OR td_id=29 OR td_id=10 OR td_id=11 OR td_id=12";
    $result = $db->Execute($sql);
    
    while (!$result->EOF)
    {
	$data[$result->fields['td_id']] = $result->fields['td_value'];
	$result->MoveNext();
    }
    
    $result->Close();
?>

<h3 class="pageTitle">จัดการ facebook &amp; twitter</h3>
<script type="text/javascript">
    $(function() {
        $("#tabs").tabs();
    });
    
    $(document).ready(function(){
        
        $('.submitBt').click(function(){
            $('.submit_indicator').css('display','inline');
            $('#error_msg').css('display','none');
            $('#success_msg').css('display','none');
            var tsrdata = $('#emailfbtwfrm').serialize();
            $.post('function/facebook_twitter_email.php',tsrdata,function(data){
                $('.submit_indicator').css('display','none');
                if(trim(data)=='success')
                {
                    $('#success_msg').html('แก้ไขข้อมูลเรียบร้อยแล้ว');
                    $("#success_msg").show('highlight',3000,function(){
                        $("#success_msg").hide('highlight',3000);
                    });
                }
                else
                {
                    $('#error_msg').html('ไม่สามารถแก้ไขข้อมูลได้ กรุณาลองใหม่ภายหลัง');
                    $("#error_msg").show('highlight',3000,function(){
                        $("#error_msg").hide('highlight',3000);
                    });
                }
            });
        });
        
    });
    
</script>
<div id="tabs" class="carAdd">
    
    <ul>
        <li id="car_"><a href="#tabs-1" title="Email">facebook &amp; twitter</a></li>
    </ul>
    
    <div id="tabs-1" class="promoImgFrm">
        <form style="margin-bottom:25px;" id="emailfbtwfrm">
            <p class="boxTitle">
                Facebook :<br />
                <input type="text" class="text_input" name="facebook" id="facebook" value="<?php echo $data[28]; ?>" />
            </p>
            
            <p class="boxTitle">
                Twitter : <br />
                <input type="text" class="text_input" name="twitter" id="twitter" value="<?php echo $data[29]; ?>" />
            </p>
            
            <!--<p class="boxTitle">-->
            <!--                        อีเมล์หน้าโรงเรียนที่ผู้ปกครองไว้วางใจ : <br />-->
            <!--    <textarea class="styled_textarea2" name="trust_email" id="trust_email"><?php echo $data[6]; ?></textarea>-->
            <!--</p>-->
            <!---->
            <!--<p class="boxTitle">-->
            <!--                        อีเมล์หน้าข่าวการศึกษา : <br />-->
            <!--    <input type="text" class="text_input" name="news_email" id="news_email" value="<?php echo $data[10]; ?>" />-->
            <!--</p>-->
            <!---->
            <!--<p class="boxTitle">-->
            <!--                        อีเมล์ job alert : <br />-->
            <!--    <input type="text" class="text_input" name="job_email" id="job_email" value="<?php echo $data[11]; ?>" />-->
            <!--</p>-->
            <!---->
            <!--<p class="boxTitle">-->
            <!--                        อีเมล์ contact alert : <br />-->
            <!--    <input type="text" class="text_input" name="contact_email" id="contact_email" value="<?php echo $data[12]; ?>" />-->
            <!--</p>-->
            <!---->
            <p>
                <input type="button" class="button submitBt" value="Save" />
                &nbsp;<img src="images/ajax-loader.gif" class="ajax_load_img submit_indicator"/>
            </p>
        </form>
        <div class="fail canhide png_bg ajax_msg" id="error_msg"></div>
        <div class="success canhide ajax_msg" id="success_msg"></div>
    </div>
</div>